package com.apes.fn.ssm.repository;

import com.apes.fn.ssm.model.FittingMessage;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FittingMessageRepository extends CustomRepository<FittingMessage,String> {

    @Query(value = "SELECT A.CATEGORY_ID FROM MAS_SUB_CATEGORY A WHERE A.FITTING_MESSAGE_ID IN :id",nativeQuery = true)
    List<String> findAllCategoryId(@Param("id") List<String> id);

    @Query(value = "SELECT A.CATEGORY_ID FROM MAS_SUB_CATEGORY A WHERE A.FITTING_MESSAGE_ID = :id",nativeQuery = true)
    List<String> findAllCategoryId(@Param("id")String id);

    @Query(value = "SELECT A.ID FROM MAS_FITTING_MESSAGE A WHERE A.NAME = :name", nativeQuery = true)
    String findOneId(@Param("name") String name);

    @Query(value = "SELECT A.* FROM MAS_FITTING_MESSAGE A WHERE A.NAME = :name", nativeQuery = true)
    FittingMessage findOneName(@Param("name") String name);
}
